﻿<Window x:Class="DTC.Popups.DrugPrescriptionPopup"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Converters="clr-namespace:DTC.Converters"
        xmlns:Res="clr-namespace:DTC.Resources"
        xmlns:Validations="clr-namespace:DTC.Validations"
        Title="Назначение препарата" Style="{StaticResource PopupWindow}"
        Closing="Window_Closing" Loaded="Window_Loaded"
        Height="600" Width="440">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/Brushes.xaml"/>
                <ResourceDictionary Source="../Resources/ListBoxStyles.xaml"/>
                <ResourceDictionary Source="../Resources/TextEditStyles.xaml"/>
                <ResourceDictionary Source="../Resources/TextBlockStyles.xaml"/>
                <ResourceDictionary Source="../Resources/ComboBoxesStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <Border x:Key="DrugDoseToolTip"
                    Padding="5">
                <StackPanel>
                    <TextBlock>
                            Для задания суотчной дозы введите<LineBreak/>
                            числовое значене и размерность.<LineBreak/>
                            Например:
                    </TextBlock>
                    <TextBlock FontWeight="Bold">
                        20 мкг
                    </TextBlock>
                </StackPanel>
            </Border>
            <Border x:Key="FreqOfUseToolTip">
                <StackPanel>
                    <TextBlock>
                        Для задания ритма введения необходимо указать<LineBreak/>
                        период и количество приемов в течении<LineBreak/>
                        этого периода.
                        Например:
                    </TextBlock>
                    <TextBlock FontWeight="Bold">
                        3 раза в неделю<LineBreak/>
                        1 раз в месяц<LineBreak/>
                    </TextBlock>
                </StackPanel>
            </Border>
        </ResourceDictionary>
    </Window.Resources>
    <Grid Name="MainGrid" Margin="20">
        <StackPanel Grid.Column="0" VerticalAlignment="Center">
            <WrapPanel>
                <TextBlock Foreground="{StaticResource MarkingFontColor}"
                       Text="Пациент: "
                       VerticalAlignment="Center"/>
                <TextBox Name="PatientComboBox"
                     Height="19" Width="235"
                     Text="{Binding DTCPatient.Name}"
                     IsReadOnly="True"/>
            </WrapPanel>
            <WrapPanel Margin="0,15,0,0">
                <TextBlock Foreground="{StaticResource MarkingFontColor}"
                       Text="Назначивший доктор: "
                       VerticalAlignment="Center"/>
                <ComboBox Name="DoctorComboBox"
                      Height="19" Width="185"
                      DisplayMemberPath="FullName"
                      SelectedItem="{Binding DTCDoctor}"
                      IsEditable="True"/>
            </WrapPanel>
            <WrapPanel Margin="0,15,0,0">
                <TextBlock Foreground="{StaticResource MarkingFontColor}"
                       Text="Дата назначения: "
                       VerticalAlignment="Center"/>
                <AdornerDecorator>
                    <TextBox Width="100"
                     Margin="5,0,0,0"
                     Name="PrescDateTB">
                        <Binding Path="DateOfPrescription">
                            <Binding.ValidationRules>
                                <Validations:DateValidation/>
                            </Binding.ValidationRules>
                            <Binding.Converter>
                                <Converters:DateTimeToDateConverter></Converters:DateTimeToDateConverter>
                            </Binding.Converter>
                        </Binding>
                        <Res:WatermarkService.Watermark>
                            <TextBlock Text="дд.мм.гггг"
                                                   FontSize="11"
                                                   FontFamily="Arial"
                                                   FontStyle="Italic"
                                                   Foreground="Black"
                                                   HorizontalAlignment="Center"/>
                        </Res:WatermarkService.Watermark>
                    </TextBox>
                </AdornerDecorator>
            </WrapPanel>
            <WrapPanel Margin="0,15,0,0">
                <TextBlock Foreground="{StaticResource MarkingFontColor}"
                       Text="Дата начала курса: "
                       VerticalAlignment="Center"/>
                <AdornerDecorator>
                    <TextBox Width="100"
                     Margin="5,0,0,0"
                     Name="CourseStartDateTB">
                        <Binding Path="CourseStartDate" Mode="TwoWay">
                            <Binding.ValidationRules>
                                <Validations:DateValidation/>
                            </Binding.ValidationRules>
                            <Binding.Converter>
                                <Converters:DateTimeToDateConverter></Converters:DateTimeToDateConverter>
                            </Binding.Converter>
                        </Binding>
                        <Res:WatermarkService.Watermark>
                            <TextBlock Text="дд.мм.гггг"
                                                   FontSize="11"
                                                   FontFamily="Arial"
                                                   FontStyle="Italic"
                                                   Foreground="Black"
                                                   HorizontalAlignment="Center"/>
                        </Res:WatermarkService.Watermark>
                    </TextBox>
                </AdornerDecorator>
            </WrapPanel>
            <WrapPanel Margin="0,15,0,0">
                <TextBlock Foreground="{StaticResource MarkingFontColor}"
                       Text="Продолжительность курса: "
                       VerticalAlignment="Center"/>
                <TextBox Width="100"
                     Margin="5,0,0,0"
                     Name="CourseDurationTB">
                    <TextBox.Text>
                        <Binding Path="CourseDurationDays">
                            <Binding.Converter>
                                <Converters:IntDaysToStringTimeSpan/>
                            </Binding.Converter>
                        </Binding>
                    </TextBox.Text>
                </TextBox>

            </WrapPanel>
            <WrapPanel Margin="0,25,0,0">
                <TextBlock Foreground="{StaticResource MarkingFontColor}"
                       Text="Препарат: "
                       VerticalAlignment="Top"
                       Margin="0,3,0,0"/>
                <ComboBox Name="DrugComboBox" 
                      DisplayMemberPath="Name"
                      Height="23" Width="229"
                      Style="{StaticResource HighlightedComboBox}"
                          SelectionChanged="DrugComboBox_SelectionChanged"
                      IsEditable="True">
                </ComboBox>
            </WrapPanel>
            <WrapPanel Margin="0,25,0,0">
                <TextBlock Foreground="{StaticResource MarkingFontColor}"
                       Text="Форма выпуска: "
                       VerticalAlignment="Top"
                       Margin="0,3,0,0"/>
                <ComboBox Name="DrugUnitsComboBox" 
                      DisplayMemberPath="IssueFormName"
                      Height="23" Width="150"
                      Style="{StaticResource HighlightedComboBox}"
                      IsEditable="True">
                </ComboBox>
            </WrapPanel>
            <WrapPanel Margin="0,15,0,0">
                <TextBlock Foreground="{StaticResource MarkingFontColor}"
                       Text="Суточная доза: "
                       VerticalAlignment="Center"/>
                <TextBox Name="DrugDoseTB"
                         Width="150"
                         Margin="5,0,0,0"
                         ToolTip="{StaticResource DrugDoseToolTip}"/>
            </WrapPanel>
            <WrapPanel Margin="0,15,0,0">
                <TextBlock Foreground="{StaticResource MarkingFontColor}"
                       Text="Ритм введения: "
                       VerticalAlignment="Center"/>
                <TextBox Name="DrugFreqOfUseTB"
                         Width="150"
                         Margin="5,0,0,0"
                         ToolTip="{StaticResource FreqOfUseToolTip}"/>
            </WrapPanel>
        </StackPanel>
    </Grid>
</Window>
